<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
		arr = [45,2,2,2,2,54,5,45,4,5];
		temp = [];
		for (var i in arr) {
			if(temp.indexOf(arr[i])=='-1'){
				temp.push(arr[i])
			}
		}
		// document.write(temp);


		arr = [45,45,555,68,29,2];

		for (var j = 0; j < arr.length-1; j++) {
			for (var i = 0; i < arr.length-j-1; i++) {
				if(arr[i]>arr[i+1]){
					temp = arr[i];
					arr[i] = arr[i+1];
					arr[i+1] = temp;
				}
			}
		}

		// document.write(arr);



		str =  'sadfek jwejkrjk bw5kjcm vnkjsdhf';

		index = 0;
		while(index!='-1'){
			index = str.indexOf('j',index+1);
			if(index!='-1'){
				document.write(index+",");
			}
		}

		str = "NskdfSDfkndf";

		temp = '';

		for (var i = 0; i < str.length; i++) {
			if(str[i]==str[i].toUpperCase()){
				temp +=str[i].toLowerCase()
			}else{
				temp +=str[i].toUpperCase()
			}
		}

		document.write(temp);


		arr = [89,67,80,69,90,40,100,70];

		function getAvg(arr) {
			var min = arr[0];
			var max = arr[0];
			var sum = 0;
			for( i in arr){
				if(arr[i]>max){
					max = arr[i];
				}
				if(arr[i]<min){
					min = arr[i];
				}
				sum  += arr[i];
			}
			avg = (sum-max-min)/(arr.length-2);
			return avg;
		}

		res = getAvg(arr);

		document.write(res);














	</script>
</head>
<body>
	
</body>
</html>